package com.zrfintech.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zrfintech.common.pojo.BasePageEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.zrfintech.domain.SpProduct;
import com.zrfintech.dao.SpProductDao;
@Service
public class SpProductRepoI{

   @Autowired
   protected SpProductDao dao;

   public SpProduct getById(Long id) {
      return dao.selectById(id);
   }

   public List<SpProduct> getAll() {
      return dao.selectList(null);
   }

   public int deleteById(Long id) {
      return dao.deleteById(id);
   }

   public int create(SpProduct item) {
      return dao.create(item);
   }

   public int updateById(SpProduct item) {
      return dao.updateById(item);
   }

   public boolean hasById(Long id) {
      return dao.selectById(id) == null;
   }

   public Page<SpProduct> pageList(BasePageEntity basePageEntity, QueryWrapper<SpProduct> queryWrapper) {
      Page<SpProduct> rowPage = new Page(basePageEntity.getPage(), basePageEntity.getPerPage());
      return dao.selectPage(rowPage, queryWrapper);
   }

   public static final String ID_COLUMN = "id";

   public static final String CTS_COLUMN = "cts";

   public static final String UTS_COLUMN = "uts";

   public static final String PRODUCT_ID_COLUMN = "product_id";

   public static final String PRODUCT_NAME_COLUMN = "product_name";

   public static final String PRODUCT_DESC_COLUMN = "product_desc";
}
